package com.example.demo.algorithm.sort;

import net.bytebuddy.build.Plugin;

public class bubbleSort {
    public static void main(String[] args) {
        int[] arr = {1, 3, 2, 5, 4, 7, 6, 9, 8};
        bubbleSort(arr);
        for (int i : arr) {
            System.out.print(i);
        }
    }

    public static void bubbleSort(int[] arr){
        for(int i = 0;i < arr.length;i++){
            for (int j = i + 1; j < arr.length; j++) {
                if(arr[i] > arr[j]){
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
    }
}
